from twisted.python.util import println


class Person(object):
    def __init__(self,name,age):
        self._name = name
        self._age = age

    __slots__ = ("_name", "_age", "_gender", "_gender1")
    
    @classmethod
    def isNb(cls, a):
        println(1, "NB - Class Method")
    
    @staticmethod
    def isNbStatic(a):
        println(1, "NB - Static Method")
        
    @property
    def name111(self):
        return self._name


    @property
    def age(self):
        return self._age
    
    @age.setter
    def age(self, age):
        self._age = age

    @name111.setter
    def name111(self,name):
        self._name = name





if __name__ == '__main__':
    person = Person("tuanzhang", 19)
    println(person.name111)
    println(person._name)

    ## 假如没有 @name111.setter  直接赋值，Python 会动态地创建新的属性 name111 并赋值
    person.name111 = "lalalal"
    println(person.name111)
    println(person._name)

    person._gender = "男"
    person._gender1 = "女"

    println(person._gender)
    println(person._gender1)


    # Call the class method and static method properly
    person.isNb(1)
    Person.isNb(1)
    Person.isNbStatic(2)



